<html>
<head><meta charset="utf-8"><title>subtyping · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html">subtyping</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="195474967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195474967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195474967">(Apr 27 2020 at 21:05)</a>:</h4>
<p>I've also been working on rebasing an old branch</p>



<a name="195474981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195474981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195474981">(Apr 27 2020 at 21:05)</a>:</h4>
<p>that would be a basis for chalk handling subtyping properly</p>



<a name="195474992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195474992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195474992">(Apr 27 2020 at 21:05)</a>:</h4>
<p>I had hoped to write up some mentoring instructions here</p>



<a name="195475005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195475005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195475005">(Apr 27 2020 at 21:05)</a>:</h4>
<p>but I prob won't get to it today</p>



<a name="195475062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195475062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195475062">(Apr 27 2020 at 21:06)</a>:</h4>
<p>but <span class="user-mention" data-user-id="251766">@Areredify</span> am I correct you'd be interested in pursuing work in this direction?</p>



<a name="195475135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195475135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195475135">(Apr 27 2020 at 21:06)</a>:</h4>
<p>roughly speaking the idea is to extend unification so that it can handle "subtyping", like Rust does; there's some example code in rustc to build from. This is required to get type equality for types like <code>fn(&amp;x)</code> correct, since the current code doesn't handle variance correctly.</p>



<a name="195475184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195475184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195475184">(Apr 27 2020 at 21:07)</a>:</h4>
<p>e.g., somewhat surprisingly <code>for&lt;'a&gt; fn(&amp;'a u32, &amp;'a u32)</code> and <code>for&lt;'a, 'b&gt; fn(&amp;'a u32, &amp;'b u32)</code> ought to be considered equal, though rustc doesn't quite get this right today (that's work in progress too)</p>



<a name="195475277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195475277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195475277">(Apr 27 2020 at 21:08)</a>:</h4>
<p>Sure thing, I would love to work on this</p>



<a name="195476156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195476156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195476156">(Apr 27 2020 at 21:16)</a>:</h4>
<p>I don't even know what to make of that example</p>



<a name="195476164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195476164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195476164">(Apr 27 2020 at 21:16)</a>:</h4>
<p>Those are...equal?</p>



<a name="195476770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195476770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195476770">(Apr 27 2020 at 21:21)</a>:</h4>
<p>As I understand it: because there is no output lifetime and the domains of both functions are equal (any pair of references), they are equal</p>



<a name="195477172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195477172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195477172">(Apr 27 2020 at 21:25)</a>:</h4>
<p>Yeah, I mean, conceptually I sort of understand it that neither lifetime is bounded by anything so they are the same</p>



<a name="195481982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195481982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195481982">(Apr 27 2020 at 22:16)</a>:</h4>
<p>Think of it like this:</p>



<a name="195482003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195482003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195482003">(Apr 27 2020 at 22:16)</a>:</h4>
<p>The two functions can call one another</p>



<a name="195482028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195482028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195482028">(Apr 27 2020 at 22:16)</a>:</h4>
<p>Because in one case, the function takes two references with same lifetime, so it can obviously call the other with both lifetimes equal to the same thing</p>



<a name="195482052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195482052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195482052">(Apr 27 2020 at 22:17)</a>:</h4>
<p>In the other case, the "single lifetime" can be the intersection of the two lifetimes, and that works by subtyping</p>



<a name="195482061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195482061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195482061">(Apr 27 2020 at 22:17)</a>:</h4>
<p>Gotta go</p>



<a name="195482086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195482086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195482086">(Apr 27 2020 at 22:17)</a>:</h4>
<p>The key thing is that the lifetimes only appear in fn parameters</p>



<a name="195636440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195636440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195636440">(Apr 28 2020 at 22:28)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> ok, I wrote up some stuff <a href="https://github.com/rust-lang/chalk/issues/418" title="https://github.com/rust-lang/chalk/issues/418">here</a> -- I have a branch I was rebasing that does the very first step, I'm going to try and open a PR with that</p>



<a name="195637629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195637629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195637629">(Apr 28 2020 at 22:41)</a>:</h4>
<p>ambient variance is a funny concept</p>



<a name="195689590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195689590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195689590">(Apr 29 2020 at 10:40)</a>:</h4>
<p>it's sort of a "misnomer"</p>



<a name="195689598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/195689598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#195689598">(Apr 29 2020 at 10:40)</a>:</h4>
<p>it's really tracking the relation between the two types</p>



<a name="199241032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199241032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199241032">(May 30 2020 at 06:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> so I'm going through some of the rustc integration, and one thing that we haven't implemented yet is <code>PredicateKind::Subtype</code></p>



<a name="199241055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199241055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199241055">(May 30 2020 at 06:07)</a>:</h4>
<p>And I realize - I actually have little clue to how this works in rustc (and even somewhat <em>what</em> it is)</p>



<a name="199241058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199241058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199241058">(May 30 2020 at 06:07)</a>:</h4>
<p>So, I was wonder if maybe we could  talk about it on Tuesday?</p>



<a name="199241065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199241065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199241065">(May 30 2020 at 06:08)</a>:</h4>
<p>I mostly bring it up now, since I imagine you'll probably end up doing a bunch of the explaining. And might want time to prepare</p>



<a name="199241109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199241109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199241109">(May 30 2020 at 06:08)</a>:</h4>
<p>But, we can also segue into what the chalk side of this would look like</p>



<a name="199373134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199373134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199373134">(Jun 01 2020 at 14:06)</a>:</h4>
<p>ah yes I opened a rough issue on thishttps://github.com/rust-lang/chalk/issues/418</p>



<a name="199373143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199373143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199373143">(Jun 01 2020 at 14:06)</a>:</h4>
<p>but I don't think I added a lot of details</p>



<a name="199376316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199376316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199376316">(Jun 01 2020 at 14:34)</a>:</h4>
<p>Oh, I forgot that issue existed</p>



<a name="199404882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/199404882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#199404882">(Jun 01 2020 at 18:24)</a>:</h4>
<p><a href="https://github.com/rust-lang-nursery/chalk/issues/418">chalk#418</a> -- now with functional link</p>



<a name="201927472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927472">(Jun 25 2020 at 02:51)</a>:</h4>
<p>So, I looked a bit more at this today</p>



<a name="201927478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927478">(Jun 25 2020 at 02:51)</a>:</h4>
<p>And kind of run into a snag</p>



<a name="201927531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927531">(Jun 25 2020 at 02:52)</a>:</h4>
<p>We're imagining some callback on <code>RustIrDatabase</code> for transforming the variance of substs</p>



<a name="201927537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927537">(Jun 25 2020 at 02:53)</a>:</h4>
<p>And that would be called from <code>Zipper</code> probably</p>



<a name="201927551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927551">(Jun 25 2020 at 02:53)</a>:</h4>
<p>the problem is that we don't have a <code>&amp;dyn RustIrDatabase</code> in them</p>



<a name="201927743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927743">(Jun 25 2020 at 02:58)</a>:</h4>
<p>for example, <code>apply_answer_subst</code> is called from <code>chalk-engine</code> with an interner, but that calls <code>AnswerSubstitutor::substitute</code> which calls down to <code>Unifier</code>, etc etc</p>



<a name="201927761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927761">(Jun 25 2020 at 02:59)</a>:</h4>
<p>actually, that statement isn't 100% correct</p>



<a name="201927762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927762">(Jun 25 2020 at 02:59)</a>:</h4>
<p>but the gist is the same</p>



<a name="201927816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927816">(Jun 25 2020 at 03:00)</a>:</h4>
<p>So, I'm sort of lost</p>



<a name="201927829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927829">(Jun 25 2020 at 03:00)</a>:</h4>
<p>maybe this might be solved if chalk-engine depends on chalk-solve</p>



<a name="201927841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/201927841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#201927841">(Jun 25 2020 at 03:01)</a>:</h4>
<p>but it's a bit icky</p>



<a name="202029715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202029715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202029715">(Jun 25 2020 at 21:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> you around?</p>



<a name="202029726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202029726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202029726">(Jun 25 2020 at 21:50)</a>:</h4>
<p>any feedback here?</p>



<a name="202144214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144214">(Jun 26 2020 at 21:22)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> is this what motivated your PR inverting the crate structure?</p>



<a name="202144240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144240">(Jun 26 2020 at 21:23)</a>:</h4>
<p>Well, sort of</p>



<a name="202144279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144279">(Jun 26 2020 at 21:23)</a>:</h4>
<p>I'm not entirely sure what to do here</p>



<a name="202144339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144339">(Jun 26 2020 at 21:24)</a>:</h4>
<p>And inverting the crate structure has already been on the todo</p>



<a name="202144359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144359">(Jun 26 2020 at 21:24)</a>:</h4>
<p>(or at least experimenting with it)</p>



<a name="202144393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144393">(Jun 26 2020 at 21:24)</a>:</h4>
<p>well it does seem undeniable that we need a <code>dyn RustIrDatabase</code> to do this</p>



<a name="202144422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144422">(Jun 26 2020 at 21:24)</a>:</h4>
<p>or at least some kind of <code>dyn</code> something  or other:)</p>



<a name="202144498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144498">(Jun 26 2020 at 21:25)</a>:</h4>
<p>I mean we could make a trait that chalk-ir owns</p>



<a name="202144509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144509">(Jun 26 2020 at 21:25)</a>:</h4>
<p>which <code>RustIrDatabase</code> extends</p>



<a name="202144570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144570">(Jun 26 2020 at 21:26)</a>:</h4>
<p>Might have to</p>



<a name="202144582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144582">(Jun 26 2020 at 21:26)</a>:</h4>
<p>that seems fine</p>



<a name="202144622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202144622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202144622">(Jun 26 2020 at 21:26)</a>:</h4>
<p>cool</p>



<a name="202370200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202370200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202370200">(Jun 29 2020 at 21:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> you around?</p>



<a name="202370208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202370208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202370208">(Jun 29 2020 at 21:27)</a>:</h4>
<p>Going through your review comments</p>



<a name="202370228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202370228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202370228">(Jun 29 2020 at 21:27)</a>:</h4>
<p>might drop a few thoughts here or on the PR</p>



<a name="202370488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202370488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202370488">(Jun 29 2020 at 21:30)</a>:</h4>
<p>I'm a little bit confused</p>



<a name="202370514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202370514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202370514">(Jun 29 2020 at 21:30)</a>:</h4>
<p>mostly because I tried to follow how rustc does things</p>



<a name="202370544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202370544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202370544">(Jun 29 2020 at 21:31)</a>:</h4>
<p>And the only use of <code>xform</code> I could find was in <code>combine.rs</code></p>



<a name="202371178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202371178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202371178">(Jun 29 2020 at 21:37)</a>:</h4>
<p>I guess I also made it a bit confusing because I sort of co-opted <code>Unifier</code> for both <code>equate</code> and <code>sub</code></p>



<a name="202470498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202470498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202470498">(Jun 30 2020 at 17:41)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> I'm around now, I can try to respond</p>



<a name="202470613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202470613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202470613">(Jun 30 2020 at 17:42)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="202470626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202470626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202470626">(Jun 30 2020 at 17:42)</a>:</h4>
<p>I'm still pretty confused</p>



<a name="202470644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202470644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202470644">(Jun 30 2020 at 17:42)</a>:</h4>
<p>but working through it, I think</p>



<a name="202472820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202472820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202472820">(Jun 30 2020 at 18:00)</a>:</h4>
<p>so, first off, there's always the chance that <em>I'm</em> confused</p>



<a name="202472850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202472850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202472850">(Jun 30 2020 at 18:00)</a>:</h4>
<p>but there is one thing I want to point out</p>



<a name="202472856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202472856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202472856">(Jun 30 2020 at 18:00)</a>:</h4>
<p>in rustc, we have the <code>relate_with_variance</code> method, right?</p>



<a name="202472901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202472901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202472901">(Jun 30 2020 at 18:00)</a>:</h4>
<p><em>but</em> calling <code>relate_with_variance(v)</code> doesn't indicate that the "ambient variance" for the item being related is <code>v</code></p>



<a name="202472915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202472915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202472915">(Jun 30 2020 at 18:01)</a>:</h4>
<p>rather, <code>v</code> is <em>combined</em> with the existing ambient variance to yield the new ambient variance</p>



<a name="202472931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202472931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202472931">(Jun 30 2020 at 18:01)</a>:</h4>
<p>however, this takes place in the impls of relate</p>



<a name="202472972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202472972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202472972">(Jun 30 2020 at 18:01)</a>:</h4>
<p>basically the relate trait in rustc only encodes the variance of each type relative to itself</p>



<a name="202473076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473076">(Jun 30 2020 at 18:02)</a>:</h4>
<p>that is, if you have <code>Foo&lt;T&gt;</code>, then <code>Foo</code> may be covariant with respect to <code>T</code></p>



<a name="202473082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473082">(Jun 30 2020 at 18:02)</a>:</h4>
<p>and we'll invoke <code>relate_with_variance(Covariance)</code></p>



<a name="202473101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473101">(Jun 30 2020 at 18:02)</a>:</h4>
<p>but if the <code>Foo&lt;T&gt;</code> itself is occuring in some invariant context, that's kind of irrelevant</p>



<a name="202473127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473127">(Jun 30 2020 at 18:02)</a>:</h4>
<p>so e.g. if you have <code>Cell&lt;Foo&lt;T&gt;&gt;</code>, that combined type is invariant with respect to <code>T</code></p>



<a name="202473159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473159">(Jun 30 2020 at 18:02)</a>:</h4>
<p>(because <code>Cell&lt;U&gt;</code> is invariant with respect to <code>U</code>)</p>



<a name="202473190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473190">(Jun 30 2020 at 18:03)</a>:</h4>
<p>I think I was hoping to pull some of that "ambient variance tracking" logic into the trait this time</p>



<a name="202473213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473213">(Jun 30 2020 at 18:03)</a>:</h4>
<p>because in rustc there are many impls all doing the same general thing</p>



<a name="202473503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473503">(Jun 30 2020 at 18:06)</a>:</h4>
<p>I think I figured it out :)</p>



<a name="202473597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473597">(Jun 30 2020 at 18:06)</a>:</h4>
<p>let me push and you can take a look</p>



<a name="202473768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202473768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202473768">(Jun 30 2020 at 18:08)</a>:</h4>
<p>I do need some help with what tests I need to add</p>



<a name="202474018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202474018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202474018">(Jun 30 2020 at 18:10)</a>:</h4>
<p>It's still not 100% done yet, but getting closer</p>



<a name="202474200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202474200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202474200">(Jun 30 2020 at 18:11)</a>:</h4>
<p>in particular, I need to handle each of the variances in the <code>relate_*</code> functions on <code>Unifier</code></p>



<a name="202475192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202475192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202475192">(Jun 30 2020 at 18:19)</a>:</h4>
<p>OK</p>



<a name="202475305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202475305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202475305">(Jun 30 2020 at 18:20)</a>:</h4>
<p>ints and floats are also unified right? No subtyping?</p>



<a name="202475429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202475429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202475429">(Jun 30 2020 at 18:21)</a>:</h4>
<p>And, what do we need to do for aliases</p>



<a name="202482156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482156">(Jun 30 2020 at 19:18)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> yes, that's right. as for aliases, the basic strategy is to </p>
<ul>
<li>introduce a variable <code>?X</code> and a goal <code>AliasEq(Alias = ?X)</code></li>
<li>and then relate the type <code>T</code> and <code>?X</code></li>
</ul>
<p>Of course, if it's just equality, you don't need the <code>?X</code>. And this also raises the question of what to do with <code>Subtype(T, ?X)</code> where <code>?X</code> is not yet bound to anything (rustc uses a particular approach called generalization).</p>



<a name="202482305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482305">(Jun 30 2020 at 19:19)</a>:</h4>
<p>Hmm</p>



<a name="202482414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482414">(Jun 30 2020 at 19:20)</a>:</h4>
<p>(we'll have to use generalization too but I would not worry about that for now, we can leave a FIXME and just use the unify path)</p>



<a name="202482426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482426">(Jun 30 2020 at 19:20)</a>:</h4>
<p>What exactly does generalization <em>do</em>?</p>



<a name="202482459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482459">(Jun 30 2020 at 19:20)</a>:</h4>
<p>I saw the impl, but didn't look at it much</p>



<a name="202482527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482527">(Jun 30 2020 at 19:21)</a>:</h4>
<p><a href="http://smallcultfollowing.com/babysteps/blog/2014/07/09/an-experimental-new-type-inference-scheme-for-rust/">http://smallcultfollowing.com/babysteps/blog/2014/07/09/an-experimental-new-type-inference-scheme-for-rust/</a></p>



<a name="202482533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482533">(Jun 30 2020 at 19:21)</a>:</h4>
<p>not sure if there's a more recent write-up</p>



<a name="202482542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482542">(Jun 30 2020 at 19:21)</a>:</h4>
<p>but the basic idea hasn't changed</p>



<a name="202482588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202482588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202482588">(Jun 30 2020 at 19:21)</a>:</h4>
<p>oh of course there's a writeup</p>



<a name="202483662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202483662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202483662">(Jun 30 2020 at 19:31)</a>:</h4>
<blockquote>
<p>One form of subtyping that exists in Rust is not amenable to this inference. It has to do with universal quantification and function types.</p>
</blockquote>
<p>Is this implemented "correctly" in rustc right now?</p>



<a name="202483771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202483771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202483771">(Jun 30 2020 at 19:32)</a>:</h4>
<p>Basically, I'm asking that if I ported the generalize code from rustc, is going to work correctly</p>



<a name="202485274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202485274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202485274">(Jun 30 2020 at 19:44)</a>:</h4>
<p>It is implemented as described in the blog post</p>



<a name="202485303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202485303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202485303">(Jun 30 2020 at 19:44)</a>:</h4>
<p>That's just a limitation and chalk will inherit it</p>



<a name="202485326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202485326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202485326">(Jun 30 2020 at 19:44)</a>:</h4>
<p>In practice this basically...never comes up?</p>



<a name="202485356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202485356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202485356">(Jun 30 2020 at 19:44)</a>:</h4>
<p>Maybe someday we'll solve it, not sure</p>



<a name="202485391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202485391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202485391">(Jun 30 2020 at 19:45)</a>:</h4>
<p>There are some papers I've been meaning to examine that are focused on inference around higher-ranked things that may have some good ideas</p>



<a name="202485498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202485498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202485498">(Jun 30 2020 at 19:46)</a>:</h4>
<p>oh okay</p>



<a name="202496151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202496151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202496151">(Jun 30 2020 at 21:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> do you think you could help come up with some tests to add for this?</p>



<a name="202708705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202708705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202708705">(Jul 02 2020 at 16:04)</a>:</h4>
<p>This is also ready for another round of reviews</p>



<a name="202708716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202708716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202708716">(Jul 02 2020 at 16:04)</a>:</h4>
<p>currently rebasing</p>



<a name="202712982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202712982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202712982">(Jul 02 2020 at 16:39)</a>:</h4>
<p>rebased</p>



<a name="202725401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202725401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202725401">(Jul 02 2020 at 18:14)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> would you maybe want to port the <code>Generalizer</code> to Chalk?</p>



<a name="202744216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202744216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202744216">(Jul 02 2020 at 21:02)</a>:</h4>
<p>I imagine we'll have to, yes.</p>



<a name="202745818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202745818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202745818">(Jul 02 2020 at 21:18)</a>:</h4>
<p>Well, that was a question specially for <em>you</em> hehe</p>



<a name="202748295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202748295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202748295">(Jul 02 2020 at 21:48)</a>:</h4>
<p>oh heh</p>



<a name="202748297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202748297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202748297">(Jul 02 2020 at 21:48)</a>:</h4>
<p>I misread it</p>



<a name="202748305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/subtyping/near/202748305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/subtyping.html#202748305">(Jul 02 2020 at 21:48)</a>:</h4>
<p>I could do that</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>